function extend (Child ,Parent){
    var F = function (){};
    F.prototype =Parent.prototype;
    Child.prototype= new F();
    Child.prototype.constructor=Child;
    Child.uber =Parent.prototype;
}
function Shape() {}
Shape.prototype.name =	this.name = 'Shape';
Shape.prototype.toString = function () {
    var result = [];
    if (this.constructor.uber){
        result[result.length]=this.constructor.uber.toString();
    }
    result[result.length]= this.name;
    return result.join(',');
};

function TwoDShape(){}
extend(TwoDShape,Shape);
TwoDShape.prototype.name = '2D shape';

function Triangle(side , height){
	this.side = side;
	this.height = height;
}
extend(Triangle,TwoDShape)
Triangle.prototype.name = 'Triangle';
Triangle.prototype.getArea = function(){
		return this.side * this.height / 2;
};

var my = new Triangle(5,10);
console.log("my.getArea()");
console.log(my.getArea());
console.log("my.toString");
console.log(my.toString());
console.log("my.__proto__ === Triangle.prototype");
console.log(my.__proto__ === Triangle.prototype);
console.log("my.__proto__.constructor === Triangle");
console.log(my.__proto__.constructor === Triangle);
console.log("my.__proto__.__proto__ === TwoDShape.prototype");
console.log(my.__proto__.__proto__ === TwoDShape.prototype);
console.log("my.__proto__.__proto__.__proto__.constructor === Shape" );
console.log(my.__proto__.__proto__.__proto__.constructor === Shape );
//http://segmentfault.com/q/1010000002587267/a-1020000002587438 